package com.xx.happychatboot.middleware.springsecurity.domain.vo.response;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class AuthResponse {
    // code
    private Integer code;

    // 消息
    private String msg;

    // 认证 token
    private String accessToken;

    // 刷新 token
    private String refreshToken;

    //用户ID
    private Long userId;

    public AuthResponse(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public AuthResponse(Integer code, String msg, String accessToken, String refreshToken) {
        this.code = code;
        this.msg = msg;
        this.accessToken = accessToken;
        this.refreshToken = refreshToken;
    }

    public static AuthResponse fail(String msg) {
        return new AuthResponse(500, msg);
    }

    public static AuthResponse authFail(String msg) {
        return new AuthResponse(401, msg);
    }
}
